﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Input;
using System.ComponentModel;
using System.Collections.Generic;
//常见接口实现
namespace ArithCollect {

    public interface INotifyPc : INotifyPropertyChanged {
        void OnPropertyChanged(string pn);
        Command Act { get; set; }
        object ActParam { get; set; }
    }

    class CommonEqualityComparer<T,Key> : IEqualityComparer<T> {
        private Func<T,Key> keySelector;
        private IEqualityComparer<Key> comparer;

        public CommonEqualityComparer(Func<T,Key> keySelector,IEqualityComparer<Key> comparer) {
            this.keySelector = keySelector;
            this.comparer = comparer;
        }
        public CommonEqualityComparer(Func<T,Key> keySelector)
            : this(keySelector,EqualityComparer<Key>.Default) { }

        public bool Equals(T x,T y) {
            return comparer.Equals(keySelector(x),keySelector(y));
        }
        public int GetHashCode(T obj) {
            return comparer.GetHashCode(keySelector(obj));
        }
    }
}
